//*******************************************************************************************************************//
//ORGANIZATION:
//AUTHOR: bpeng(bogers.peng@gmail.com)
//SUMMARY:
//*******************************************************************************************************************//
#ifndef NATIVE_SYSTEM_BASE_EXCEPTION_H
#define NATIVE_SYSTEM_BASE_EXCEPTION_H

#ifndef NATIVE_SYSTEM_BASE_CASE_H
#include "System/Base/Case.h"
#endif

namespace Native { namespace System
{
    //****************************************************************************************************************//
    //CException
    //
    //****************************************************************************************************************//
    NATIVE_DECLARE_CONST_OBJECT(CCase, C_CASE);
    NATIVE_DECLARE_CONST_OBJECT(CException, C_EXCEPTION);
    class NATIVE_LIBRARY_EXPORT CException :
        public CObject,
        public IEqualTo<CException>
    {
        NATIVE_DECLARE_OBJECT;

    public:
        const static size_t MAX_MESSAGE_LENGTH = 256;

    private:
        vector<CCase> _issues;

    protected:
        CException();
    public:
        CException(C_EXCEPTION& that);
        CException(C_EXCEPTION&& that);
        CException(C_SCENE& scene, WSTRING& detail = EMPTY_STRING);
        CException(C_CASE& record);

    public:
        //IEqualTo
        virtual bool operator==(C_EXCEPTION& rvalue) const;
        virtual bool operator!=(C_EXCEPTION& rvalue) const;

        wstring Report() const;
        void Append(C_CASE& record);
        CCase LatestRecord() const;
        size_t Count() const;

        virtual C_EXCEPTION& operator=(C_EXCEPTION& rvalue);
    };
}}

#endif